﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CardGenerator
{
    class WordHandler
    {
        public void ExportWord(string S)
        {
            Microsoft.Office.Interop.Word.Application _wordApp = new Microsoft.Office.Interop.Word.Application();
            Microsoft.Office.Interop.Word.Document _wordDocument = new Microsoft.Office.Interop.Word.Document();

            try
            {
                string str = System.Windows.Forms.Application.ExecutablePath + "\\..\\..\\..\\Doc2.dotx";
                _wordDocument = _wordApp.Documents.Open(str);

                _wordDocument.Bookmarks["Вопросы"].Range.Text = S;
                _wordApp.Visible = true;

            }
            catch (System.Exception ex)
            {
                string s = ex.Message;
                _wordDocument.Close();
                _wordApp.Quit();
            }        
        }
    }

}
